<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>vaeThink</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__ADMIN__/lib/layui/css/layui.css"  media="all">
</head>
<body class="vae-body">

<form class="layui-form vae-content">

  <div class="layui-form-item">
    <label class="layui-form-label">后台标题</label>
    <div class="layui-input-block" style="max-width: 500px;">
      <input type="text" name="admin_title" lay-verify="required" autocomplete="off" placeholder="请输入网站标题" class="layui-input" value="{$webConf.admin_title}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">SEO标题</label>
    <div class="layui-input-block" style="max-width: 500px;">
      <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入网站标题" class="layui-input" value="{$webConf.title}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">SEO关键词</label>
    <div class="layui-input-block" style="max-width: 500px;">
      <input type="text" name="keywords" autocomplete="off" placeholder="多个关键词用“,”隔开" class="layui-input" value="{$webConf.keywords}">
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">SEO描述</label>
    <div class="layui-input-block" style="max-width: 600px;">
      <textarea name="desc" placeholder="请输入网站描述" class="layui-textarea">{$webConf.desc}</textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">LOGO</label>
    <div class="layui-input-inline">
      <div class="layui-upload">
        <button type="button" class="layui-btn" id="test1">上传LOGO</button>
        <div class="layui-upload-list" id="demo1">
          <img src="{$webConf.logo}" />
          <input type="hidden" name="logo" value="{$webConf.logo}">
        </div>
      </div>
    </div>
  </div> 
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">ICP备案号</label>
    <div class="layui-input-block" style="max-width: 500px;">
      <input type="text" name="icp" autocomplete="off" placeholder="请输入ICP备案号" class="layui-input" value="{$webConf.icp}">
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">统计代码</label>
    <div class="layui-input-block" style="max-width: 600px;">
      <textarea name="code" placeholder="请输入完整的统计代码" class="layui-textarea">{$webConf.code}</textarea>
    </div>
  </div>
   <div class="layui-form-item">
    <label class="layui-form-label">网站域名</label>
    <div class="layui-input-block" style="max-width: 500px;">
      <input type="text" name="domain" autocomplete="off" placeholder="请输入网站域名" class="layui-input" value="{$webConf.domain}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">api缓存时间</label>
    <div class="layui-input-block" style="max-width: 500px;">
      <input type="text" name="port_cache_time" autocomplete="off" placeholder="请输入port模块接口数据缓存时间" class="layui-input" value="{$webConf.port_cache_time}">
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="vaeform">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
          
<script src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
<script>
layui.config({
    base: '/themes/admin_themes/module/'
}).use(['upload','form','vaeyo'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,$ = layui.$
  ,upload = layui.upload
  ,vae = layui.vaeyo;

  //logo上传
  var uploadInst = upload.render({
    elem: '#test1'
    ,url: '/admin/api/upload'
    ,done: function(res){
      //如果上传失败
      if(res.code == 0){
        return layer.msg('上传失败');
      }
      //上传成功
      $('#demo1 input').attr('value',res.data);
      $('#demo1 img').attr('src',res.data);
    }
  });
  
  //监听提交
  form.on('submit(vaeform)', function(data){
    $.ajax({
      url:"/admin/conf/webConfSubmit",
      type:'post',
      data:data.field,
      success:function(e){
        if(e.code==1){
          layer.confirm('保存成功,关闭本页面吗?', {icon: 3, title:'提示'}, function(index){
            vae.closeThisTab();
            layer.close(index);
          });
        }else{
          layer.msg(e.msg);
        }
      }
    })
    return false;
  });
  
});
</script>

</body>
</html>